package net.lainiao.confirm;

import com.rabbitmq.client.Channel;
import net.lainiao.MyConst;

import java.io.IOException;
import java.util.concurrent.TimeoutException;

/**
 * Created by Administrator on 2018/7/9.
 */
public class ProviderDemo {
    public static void main(String[] args) throws IOException, TimeoutException, InterruptedException {
        Channel channel =MyConst.getChanel();
        channel.confirmSelect();
        channel.queueDeclare(MyConst.QName1,false,false,true,null);
            for (int i = 0; i <50 ; i++) {
                String mess="Confirm消息"+i;
                channel.basicPublish("",MyConst.QName1,null,mess.getBytes());
            }
        if(channel.waitForConfirms()){
            System.out.println("消息发送成功");
        }
        channel.close();
        MyConst.connection.close();
    }
}
